<?php
//INFOS SUPPORT
//MAC
$Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
 $NbMac=0;
while($rowM=mysql_fetch_array($Support)){
$SupportM=$rowM['Agent'];
	if(eregi('Mac', $SupportM) && (!eregi('iPhone', $SupportM) && !eregi('iPad', $SupportM))){
	$NbMac++;
	}
}
$RatioM=(($NbMac)*100)/$nbEmailTotal;
$RatioMOK= sprintf("%.2f",$RatioM)." % (soit ".$NbMac." ouvertures)";
//PC
$Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
 $NbPC=0;
while($rowP=mysql_fetch_array($Support)){
$SupportP=$rowP['Agent'];
	if(eregi('Windows', $SupportP)){
	$NbPC++;
	}
}
$RatioP=(($NbPC)*100)/$nbEmailTotal;
$RatioPOK= sprintf("%.2f",$RatioP)." % (soit ".$NbPC." ouvertures)";
//SMARTPHONE
 $Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
 $NbSmart=0;
while($rowNS=mysql_fetch_array($Support)){
$SupportS=$rowNS['Agent'];
	if(eregi('Android', $SupportS) || eregi('BlackBerry', $SupportS) || eregi('Symbian', $SupportS)){
	$NbSmart++;
	}
}
$RatioNS=(($NbSmart)*100)/$nbEmailTotal;
$RatioNSOK= sprintf("%.2f",$RatioNS)." % (soit ".$NbSmart." ouvertures)";
//IPHONE
$Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
  $NbIphone=0;
while($rowNI=mysql_fetch_array($Support)){
$SupportI=$rowNI['Agent'];
	if(eregi('iPhone', $SupportI)){
	$NbIphone++;
	}
}
$RatioNI=(($NbIphone)*100)/$nbEmailTotal;
$RatioNIOK= sprintf("%.2f",$RatioNI)." % (soit ".$NbIphone." ouvertures)";
//IPAD
$Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
 $NbIpad=0;
while($rowIpad=mysql_fetch_array($Support)){
$SupportIpad=$rowIpad['Agent'];
	if(eregi('Ipad', $SupportIpad)){
	$NbIpad++;
	}
}
$RatioIpad=(($NbIpad)*100)/$nbEmailTotal;
$RatioIpadOK= sprintf("%.2f",$RatioIpad)." % (soit ".$NbIpad." ouvertures)";



//INFOS NAVIGATION
//FIREFOX
$Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
$NbFF=0;
while($rowFF=mysql_fetch_array($Support)){
$NavFF=$rowFF['Agent'];
	if(eregi('Firefox', $NavFF)){
	$NbFF++;
	}
}
$RatioFF=(($NbFF)*100)/$nbEmailTotal;
$RatioFFOK= sprintf("%.2f",$RatioFF)." % (soit ".$NbFF." ouvertures)";

//INTERNET EXPLORER
 $Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
 $NbIE=0;
while($rowIE=mysql_fetch_array($Support)){
$NavIE=$rowIE['Agent'];
	if(eregi('MSIE ', $NavIE) || eregi('MSIE 6', $NavIE) || eregi('MSIE 7', $NavIE) | eregi('MSIE 8', $NavIE) | eregi('MSIE 9', $NavIE)){
	$NbIE++;
	}
}
$RatioIE=(($NbIE)*100)/$nbEmailTotal;
$RatioIEOK= sprintf("%.2f",$RatioIE)." % (soit ".$NbIE." ouvertures)";

//SAFARI
$Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
 $NbSaf=0;
while($rowSaf=mysql_fetch_array($Support)){
$NavSaf=$rowSaf['Agent'];
	if(eregi('AppleWebKit', $NavSaf)){
	$NbSaf++;
	}
}
$RatioSaf=(($NbSaf)*100)/$nbEmailTotal;
$RatioSafOK= sprintf("%.2f",$RatioSaf)." % (soit ".$NbSaf." ouvertures)";

//THUNDERBIRD
 $Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
 $NbThun=0;
while($rowThun=mysql_fetch_array($Support)){
$NavThun=$rowThun['Agent'];
	if(eregi('Thunderbird', $NavThun)){
	$NbThun++;
	}
}
$RatioThun=(($NbThun)*100)/$nbEmailTotal;
$RatioThunOK= sprintf("%.2f",$RatioThun)." % (soit ".$NbThun." ouvertures)";

//AUTRES
$Support=mysql_query("SELECT * FROM $Table ORDER BY idEmail") or die(mysql_error());
 $NbAutre=0;
while($rowAutre=mysql_fetch_array($Support)){
$NavAutre=$rowAutre['Agent'];
	if(eregi('Thunderbird', $NavAutre) || eregi('AppleWebKit', $NavAutre) || eregi('MSIE', $NavAutre) || eregi('Firefox', $NavAutre)){
	
	}
	else{
	$NbAutre++;
	}
}
$RatioAutre=(($NbAutre)*100)/$nbEmailTotal;
$RatioAutreOK= sprintf("%.2f",$RatioAutre)." % (soit ".$NbAutre." ouvertures)";
?>